package espaceVisuCarre.java2Dutil;


import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import espaceVisuCarre.*;

public class RectangleDrawable extends FormDrawable{

	private Carre carre ;
	private SectionDeCarre section ;
	
	
	/**
	 * @param color
	 * @param pos
	 * @param dim
	 */
	public RectangleDrawable(Color color, Point2D.Float center, float width , float height, boolean fill , Carre carre  , SectionDeCarre section )
	{
		super(color, center, width , height , fill);
		
		this.carre = carre ;
		this.section = section ;
	}

	/* (non-Javadoc)
	 * @see draw.Drawable#draw(java.awt.Graphics)
	 */
	public void draw(Graphics2D g) 
	{
		Color c = g.getColor();
		g.setColor(color);
		
		if(fill)
		{
			g.fill(rect);
			g.setColor(Color.BLACK);
			g.draw(rect);
		}
		else g.draw(rect);
		

		g.setColor(c);
	}
	
	
	@Override
	public boolean contains(Point2D p) 
	{
		if( rect.contains(p) )return true;
		return false;
	}

	public Carre getCarre() {
		return carre;
	}

	public SectionDeCarre getSection() {
		return section;
	}

}
